package com.house.controller;

import com.house.entity.Type;
import com.house.service.TypeService;
import com.house.util.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/type/")
@CrossOrigin(value = "*",allowCredentials ="true")
public class TypeController {
    @Autowired
    private TypeService typeService;

    @RequestMapping("getAllType")

    public BaseResult getAllType(){
        List<Type> type = typeService.getType();
        return new BaseResult(BaseResult.RESULT_SUCCESS,type);
    }
}
